angular.module('moti.controllers.adminsedit', ['moti.services.adminsService', 'directiveModule', 'moti.directive.modal'])
    .controller('adminsEditCtrl', ['$scope', '$location', 'AdminsInterface', '$modal', 'LoginName', function($scope, $location, AdminsInterface, $modal, LoginName){

        $scope.admin = {"name" : LoginName};

        //提交
        $scope.adminsEditForm = function(){
            if($scope.admins_edit_form.$valid){
                AdminsInterface.putAdmin($scope.admin).then(function(data){
                    $modal({id : 'tip-modal', text : "修改管理员成功"}).show().autoHide();
                    $location.path('/adminsList');
                });
            }
        }
    }]);